home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d892.lha / Indent / source / source.lha / configure < prev    next >
Text File  |  1993-06-16  |  14KB  |  548 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
  74.        verbose=yes ;;
  75.  
  76.      *) ;;
  77.     esac
  78.   fi
  79. done
  80.  
  81. trap 'rm -f conftest* core; exit 1' 1 3 15
  82.  
  83. # Needed for some versions of `tr' so that character classes in `[]' work.
  84. if test "${LANG+set}" = "set" ; then
  85.    LANG=C
  86. fi
  87.  
  88. rm -f conftest*
  89. compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  90.  
  91. # A filename unique to this package, relative to the directory that
  92. # configure is in, which we can look for to find out if srcdir is correct.
  93. unique_file=indent.c
  94.  
  95. # Find the source files, if location was not specified.
  96. if test -z "$srcdir"; then
  97.   srcdirdefaulted=yes
  98.   # Try the directory containing this script, then `..'.
  99.   prog=$0
  100.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  101.   test "X$confdir" = "X$prog" && confdir=.
  102.   srcdir=$confdir
  103.   if test ! -r $srcdir/$unique_file; then
  104.     srcdir=..
  105.   fi
  106. fi
  107. if test ! -r $srcdir/$unique_file; then
  108.   if test x$srcdirdefaulted = xyes; then
  109.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  110.   else
  111.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  112.   fi
  113.   exit 1
  114. fi
  115. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  116. # But we can't avoid them for `..', to make subdirectories work.
  117. case $srcdir in
  118.   .|/*|~*) ;;
  119.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  120. esac
  121.  
  122. # Save the original args to write them into config.status later.
  123. configure_args="$*"
  124.  
  125. if test -z "$CC"; then
  126.   # Extract the first word of `gcc', so it can be a program name with args.
  127.   set dummy gcc; word=$2
  128.   echo checking for $word
  129.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  130.   for dir in $PATH; do
  131.     test -z "$dir" && dir=.
  132.     if test -f $dir/$word; then
  133.       CC="gcc"
  134.       break
  135.     fi
  136.   done
  137.   IFS="$saveifs"
  138. fi
  139. test -z "$CC" && CC="cc"
  140. test -n "$CC" -a -n "$verbose" && echo "    setting CC to $CC"
  141.  
  142. # Find out if we are using GNU C, under whatever name.
  143. cat > conftest.c <<EOF
  144. #ifdef __GNUC__
  145.   yes
  146. #endif
  147. EOF
  148. ${CC-cc} -E conftest.c > conftest.out 2>&1
  149. if egrep yes conftest.out >/dev/null 2>&1; then
  150.   GCC=1 # For later tests.
  151. fi
  152. rm -f conftest*
  153.  
  154. echo checking how to run the C preprocessor
  155. if test -z "$CPP"; then
  156.   CPP='${CC-cc} -E'
  157.   cat > conftest.c <<EOF
  158. #include <stdio.h>
  159. EOF
  160. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  161. if test -z "$err"; then
  162.   :
  163. else
  164.   CPP=/lib/cpp
  165. fi
  166. rm -f conftest*
  167. fi
  168.  
  169. # Make sure to not get the incompatible SysV /etc/install and
  170. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  171. # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
  172. # or the AFS install, which mishandles nonexistent args, or
  173. # /usr/ucb/install on SVR4, which tries to use the nonexistent group
  174. # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
  175. # anyway.  Sigh.
  176. if test "z${INSTALL}" = "z" ; then
  177.   echo checking for install
  178.   IFS="${IFS=     }"; saveifs="$IFS"; IFS="${IFS}:"
  179.   for dir in $PATH; do
  180.     test -z "$dir" && dir=.
  181.     case $dir in
  182.     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
  183.     *)
  184.       if test -f $dir/installbsd; then
  185.     INSTALL="$dir/installbsd -c" # OSF1
  186.     INSTALL_PROGRAM='$(INSTALL)'
  187.     INSTALL_DATA='$(INSTALL) -m 644'
  188.     break
  189.       fi
  190.       if test -f $dir/install; then
  191.     if grep dspmsg $dir/install >/dev/null 2>&1; then
  192.       : # AIX
  193.     else
  194.       INSTALL="$dir/install -c"
  195.       INSTALL_PROGRAM='$(INSTALL)'
  196.       INSTALL_DATA='$(INSTALL) -m 644'
  197.       break
  198.     fi
  199.       fi
  200.       ;;
  201.     esac
  202.   done
  203.   IFS="$saveifs"
  204. fi
  205. INSTALL=${INSTALL-cp}
  206. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  207. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  208.  
  209. echo checking for AIX
  210. cat > conftest.c <<EOF
  211. #ifdef _AIX
  212.   yes
  213. #endif
  214.  
  215. EOF
  216. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  217. if egrep "yes" conftest.out >/dev/null 2>&1; then
  218.   {
  219. test -n "$verbose" && \
  220. echo '    defining' _ALL_SOURCE
  221. DEFS="$DEFS -D_ALL_SOURCE=1"
  222. }
  223.  
  224. fi
  225. rm -f conftest*
  226.  
  227.  
  228. echo checking for minix/config.h
  229. cat > conftest.c <<EOF
  230. #include <minix/config.h>
  231. EOF
  232. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  233. if test -z "$err"; then
  234.   MINIX=1
  235. fi
  236. rm -f conftest*
  237.  
  238. # The Minix shell can't assign to the same variable on the same line!
  239. if test -n "$MINIX"; then
  240.   {
  241. test -n "$verbose" && \
  242. echo '    defining' _POSIX_SOURCE
  243. DEFS="$DEFS -D_POSIX_SOURCE=1"
  244. }
  245.  
  246.   {
  247. test -n "$verbose" && \
  248. echo '    defining' _POSIX_1_SOURCE to be '2'
  249. DEFS="$DEFS -D_POSIX_1_SOURCE=2"
  250. }
  251.  
  252.   {
  253. test -n "$verbose" && \
  254. echo '    defining' _MINIX
  255. DEFS="$DEFS -D_MINIX=1"
  256. }
  257.  
  258. fi
  259.  
  260. echo checking for POSIXized ISC
  261. if test -d /etc/conf/kconfig.d &&
  262.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  263. then
  264.   ISC=1 # If later tests want to check for ISC.
  265.   {
  266. test -n "$verbose" && \
  267. echo '    defining' _POSIX_SOURCE
  268. DEFS="$DEFS -D_POSIX_SOURCE=1"
  269. }
  270.  
  271.   if test -n "$GCC"; then
  272.     CC="$CC -posix"
  273.   else
  274.     CC="$CC -Xp"
  275.   fi
  276. fi
  277.  
  278. echo checking for BSD string and memory functions
  279. cat > conftest.c <<EOF
  280. #include <strings.h>
  281. int main() { exit(0); }
  282. int t() { rindex(0, 0); bzero(0, 0); }
  283. EOF
  284. if eval $compile; then
  285.   :
  286. else
  287.   {
  288. test -n "$verbose" && \
  289. echo '    defining' USG
  290. DEFS="$DEFS -DUSG=1"
  291. }
  292.  
  293. fi
  294. rm -f conftest*
  295.  
  296. for func in memcpy
  297. do
  298. echo checking for ${func}
  299. cat > conftest.c <<EOF
  300.  
  301. int main() { exit(0); }
  302. int t() { /* The GNU C library defines this for functions which it implements
  303.     to always fail with ENOSYS.  Some functions are actually named
  304.     something starting with __ and the normal name is an alias.  */
  305. #if defined (__stub_${func}) || defined (__stub___${func})
  306. choke me
  307. #else
  308. /* Override any gcc2 internal prototype to avoid an error.  */
  309. extern char ${func}(); ${func}();
  310. #endif
  311.  }
  312. EOF
  313. if eval $compile; then
  314.   :
  315. else
  316.   LIBOBJS="$LIBOBJS ${func}.o"
  317. test -n "$verbose" && echo "    using ${func}.o instead"
  318. fi
  319. rm -f conftest*
  320.  
  321. done
  322.  
  323. echo checking for unistd.h
  324. cat > conftest.c <<EOF
  325. #include <unistd.h>
  326. EOF
  327. err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
  328. if test -z "$err"; then
  329.   {
  330. test -n "$verbose" && \
  331. echo '    defining' HAVE_UNISTD_H
  332. DEFS="$DEFS -DHAVE_UNISTD_H=1"
  333. }
  334.  
  335. fi
  336. rm -f conftest*
  337.  
  338. echo checking for directory library header
  339. dirheader=
  340. if test -z "$dirheader"; then
  341.   echo checking for dirent.h
  342. cat > conftest.c <<EOF
  343. #include <sys/types.h>
  344. #include <dirent.h>
  345. int main() { exit(0); }
  346. int t() { DIR *dirp = opendir ("/"); }
  347. EOF
  348. if eval $compile; then
  349.   {
  350. test -n "$verbose" && \
  351. echo '    defining' DIRENT
  352. DEFS="$DEFS -DDIRENT=1"
  353. }
  354.  dirheader=dirent.h
  355. fi
  356. rm -f conftest*
  357. fi
  358. if test -z "$dirheader"; then
  359.   echo checking for sys/ndir.h
  360. cat > conftest.c <<EOF
  361. #include <sys/types.h>
  362. #include <sys/ndir.h>
  363. int main() { exit(0); }
  364. int t() { DIR *dirp = opendir ("/"); }
  365. EOF
  366. if eval $compile; then
  367.   {
  368. test -n "$verbose" && \
  369. echo '    defining' SYSNDIR
  370. DEFS="$DEFS -DSYSNDIR=1"
  371. }
  372.  dirheader=sys/ndir.h
  373. fi
  374. rm -f conftest*
  375. fi
  376. if test -z "$dirheader"; then
  377.   echo checking for sys/dir.h
  378. cat > conftest.c <<EOF
  379. #include <sys/types.h>
  380. #include <sys/dir.h>
  381. int main() { exit(0); }
  382. int t() { DIR *dirp = opendir ("/"); }
  383. EOF
  384. if eval $compile; then
  385.   {
  386. test -n "$verbose" && \
  387. echo '    defining' SYSDIR
  388. DEFS="$DEFS -DSYSDIR=1"
  389. }
  390.  dirheader=sys/dir.h
  391. fi
  392. rm -f conftest*
  393. fi
  394. if test -z "$dirheader"; then
  395.   echo checking for ndir.h
  396. cat > conftest.c <<EOF
  397. #include <sys/types.h>
  398. #include <ndir.h>
  399. int main() { exit(0); }
  400. int t() { DIR *dirp = opendir ("/"); }
  401. EOF
  402. if eval $compile; then
  403.   {
  404. test -n "$verbose" && \
  405. echo '    defining' NDIR
  406. DEFS="$DEFS -DNDIR=1"
  407. }
  408.  dirheader=ndir.h
  409. fi
  410. rm -f conftest*
  411. fi
  412.  
  413. echo checking for closedir return value
  414. cat > conftest.c <<EOF
  415. #include <sys/types.h>
  416. #include <$dirheader>
  417. int closedir(); main() { exit(closedir(opendir(".")) != 0); }
  418. EOF
  419. eval $compile
  420. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  421.   :
  422. else
  423.   {
  424. test -n "$verbose" && \
  425. echo '    defining' VOID_CLOSEDIR
  426. DEFS="$DEFS -DVOID_CLOSEDIR=1"
  427. }
  428.  
  429. fi
  430. rm -f conftest*
  431.  
  432. if test -z "$dirheader"; then
  433.   {
  434. test -n "$verbose" && \
  435. echo '    defining' NODIR
  436. DEFS="$DEFS -DNODIR=1"
  437. }
  438.  
  439. fi
  440. echo checking for Xenix
  441. cat > conftest.c <<EOF
  442. #if defined(M_XENIX) && !defined(M_UNIX)
  443.   yes
  444. #endif
  445.  
  446. EOF
  447. eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
  448. if egrep "yes" conftest.out >/dev/null 2>&1; then
  449.   XENIX=1
  450. fi
  451. rm -f conftest*
  452.  
  453. if test -n "$XENIX"; then
  454.   LIBS="$LIBS -lx"
  455.   case "$DEFS" in
  456.   *SYSNDIR*) ;;
  457.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  458.   esac
  459. fi
  460.  
  461. if test -n "$prefix"; then
  462.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  463.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  464. fi
  465. if test -n "$exec_prefix"; then
  466.   prsub="$prsub
  467. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%exec_prefix\\1=\\2$exec_prefix%"
  468. fi
  469. cat >conftest.def <<EOF
  470. $DEFS
  471. EOF
  472. escape_ampersand_and_backslash='s%[&\\]%\\&%g'
  473. DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
  474. rm -f conftest.def
  475.  
  476. trap 'rm -f config.status; exit 1' 1 3 15
  477. echo creating config.status
  478. rm -f config.status
  479. cat > config.status <<EOF
  480. #!/bin/sh
  481. # Generated automatically by configure.
  482. # Run this file to recreate the current configuration.
  483. # This directory was configured as follows,
  484. # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
  485. #
  486. # $0 $configure_args
  487.  
  488. for arg
  489. do
  490.   case "\$arg" in
  491.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  492.     exec /bin/sh $0 $configure_args ;;
  493.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  494.   esac
  495. done
  496.  
  497. trap 'rm -f makefile; exit 1' 1 3 15
  498. CC='$CC'
  499. CPP='$CPP'
  500. INSTALL='$INSTALL'
  501. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  502. INSTALL_DATA='$INSTALL_DATA'
  503. LIBOBJS='$LIBOBJS'
  504. LIBS='$LIBS'
  505. srcdir='$srcdir'
  506. DEFS='$DEFS'
  507. prefix='$prefix'
  508. exec_prefix='$exec_prefix'
  509. prsub='$prsub'
  510. EOF
  511. cat >> config.status <<\EOF
  512.  
  513. top_srcdir=$srcdir
  514.  
  515. # Allow make-time overrides of the generated file list.
  516. test -n "$gen_files" || gen_files="makefile"
  517.  
  518. for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
  519.   srcdir=$top_srcdir
  520.   # Remove last slash and all that follows it.  Not all systems have dirname.
  521.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  522.   if test "$dir" != "$file"; then
  523.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  524.     test ! -d $dir && mkdir $dir
  525.   fi
  526.   echo creating $file
  527.   rm -f $file
  528.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  529.   sed -e "
  530. $prsub
  531. s%@CC@%$CC%g
  532. s%@CPP@%$CPP%g
  533. s%@INSTALL@%$INSTALL%g
  534. s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
  535. s%@INSTALL_DATA@%$INSTALL_DATA%g
  536. s%@LIBOBJS@%$LIBOBJS%g
  537. s%@LIBS@%$LIBS%g
  538. s%@srcdir@%$srcdir%g
  539. s%@DEFS@%$DEFS%
  540. " $top_srcdir/${file}.in >> $file
  541. fi; done
  542.  
  543. exit 0
  544. EOF
  545. chmod +x config.status
  546. test -n "$no_create" || ./config.status
  547.  
  548.